# $OpenBSD: Makefile.inc,v 1.8 2016/12/26 14:53:25 czarkoff Exp $

CATEGORIES =		telephony

HOMEPAGE =		http://www.creytiv.com/
MASTER_SITES ?=		${HOMEPAGE:=pub/}

MAINTAINER =		Dmitrij D. Czarkoff <czarkoff@openbsd.org>

# Code is BSD-licensed, but zrtp.so module is statically linked to AGPLv3-
# licensed libzrtp.  As a result, main baresip package is subject to AGPLv3.
PERMIT_PACKAGE_CDROM =	Yes

USE_GMAKE =		Yes

MAKE_ENV +=		CC="${CC}"
MAKE_ENV +=		LD="${CC}"
MAKE_ENV +=		AR="${AR}"
#MAKE_ENV +=		DFLAGS=-MD -MF config -MT config
MAKE_ENV +=		APP_LFLAGS="-rdynamic"
MAKE_ENV +=		AFLAGS="${ARFLAGS}"
MAKE_ENV +=		BUILD="build-${ARCH}"
MAKE_ENV +=		OS=openbsd
MAKE_ENV +=		LFLAGS="-fPIC -L${LOCALBASE}/lib -L/${X11BASE}/lib"
MAKE_ENV +=		SH_LFLAGS="-shared"
MAKE_ENV +=		MOD_SUFFIX=".so"
MAKE_ENV +=		SYSROOT="/usr"
MAKE_ENV +=		V=Yes
MAKE_ENV +=		LIBRE_MK=/dev/null
MAKE_ENV +=		LIBRE_INC="${LOCALBASE}/include/re"
MAKE_ENV +=		HAVE_ARC4RANDOM=1
MAKE_ENV +=		HAVE_DLFCN_H=1
MAKE_ENV +=		HAVE_EPOLL=
MAKE_ENV +=		HAVE_GETIFADDRS=1
MAKE_ENV +=		HAVE_GETOPT=1
MAKE_ENV +=		HAVE_INET6=1
MAKE_ENV +=		HAVE_INET_NTOP=1
MAKE_ENV +=		HAVE_INET_PTON=1
MAKE_ENV +=		HAVE_INTTYPES_H=1
MAKE_ENV +=		HAVE_KQUEUE=1
MAKE_ENV +=		HAVE_LIBPTHREAD=1
MAKE_ENV +=		HAVE_NET_ROUTE_H=1
MAKE_ENV +=		HAVE_PTHREAD=1
MAKE_ENV +=		HAVE_PTHREAD_RWLOCK=1
MAKE_ENV +=		HAVE_RESOLV=1
MAKE_ENV +=		HAVE_STRERROR_R=1
MAKE_ENV +=		HAVE_SYSLOG=1
MAKE_ENV +=		HAVE_SYS_SYSCTL_H=1
MAKE_ENV +=		USE_OPENSSL=yes
MAKE_ENV +=		USE_OPENSSL_AES=yes
MAKE_ENV +=		USE_OPENSSL_DTLS=yes
MAKE_ENV +=		USE_OPENSSL_HMAC=yes
MAKE_ENV +=		USE_OPENSSL_SRTP=yes
MAKE_ENV +=		USE_TLS=yes
MAKE_ENV +=		USE_ZLIB=yes

FAKE_FLAGS +=		PREFIX=${PREFIX}

CFLAGS +=		-I${X11BASE}/include -I${LOCALBASE}/include -fPIC \
			-DARCH=\"${ARCH}\" -DOPENBSD -DOS=\"openbsd\" -std=c99 \
			-DUSE_OPENSSL -DUSE_TLS -DUSE_OPENSSL_DTLS -DUSE_DTLS \
			-DUSE_OPENSSL_SRTP -DUSE_DTLS_SRTP -DUSE_ZLIB \
			-DHAVE_PTHREAD -DHAVE_GETIFADDRS -DHAVE_STRERROR_R \
			-DHAVE_GETOPT -DHAVE_INTTYPES_H -DHAVE_NET_ROUTE_H \
			-DHAVE_SYS_SYSCTL_H -DHAVE_STDBOOL_H -DHAVE_INET6 \
			-DHAVE_RESOLV -DHAVE_SYSLOG -DHAVE_FORK \
			-DHAVE_INET_NTOP -DHAVE_PWD_H -DHAVE_POLL \
			-DHAVE_INET_PTON -DHAVE_SELECT -DHAVE_SELECT_H \
			-DHAVE_SETRLIMIT -DHAVE_SIGNAL -DHAVE_SYS_TIME_H \
			-DHAVE_KQUEUE -DHAVE_UNAME -DHAVE_UNISTD_H \
			-DHAVE_STRINGS_H -DHAVE_GAI_STRERROR -DHAVE_ARC4RANDOM \
			-DVERSION=\"$V\" -DHAVE_ROUTE_LIST

NO_TEST ?=		Yes
